package com.ruoyi.deeplearn.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.deeplearn.domain.DeepMarkTaskDateset;
import com.ruoyi.deeplearn.service.IDeepMarkTaskDatesetService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 标注项目任务数据集Controller
 *
 * @author rww
 * @date 2024-09-07
 */
@RestController
@RequestMapping("/deeplearn/taskDatesetFile")
public class DeepMarkTaskDatesetController extends BaseController
{
    @Autowired
    private IDeepMarkTaskDatesetService deepMarkTaskDatesetService;

    /**
     * 查询标注项目任务数据集列表
     */
    @PreAuthorize("@ss.hasPermi('deeplearn:taskDatesetFile:list')")
    @GetMapping("/list")
    public TableDataInfo list(DeepMarkTaskDateset deepMarkTaskDateset)
    {
        startPage();
        List<DeepMarkTaskDateset> list = deepMarkTaskDatesetService.selectDeepMarkTaskDatesetList(deepMarkTaskDateset);
        return getDataTable(list);
    }
    @GetMapping("/list/all")
    public AjaxResult listAll(DeepMarkTaskDateset deepMarkTaskDateset)
    {
        List<DeepMarkTaskDateset> list = deepMarkTaskDatesetService.
                selectDeepMarkTaskDatesetList(deepMarkTaskDateset);
        return AjaxResult.success(list);
    }
    /**
     * 导出标注项目任务数据集列表
     */
    @PreAuthorize("@ss.hasPermi('deeplearn:taskDatesetFile:export')")
    @Log(title = "标注项目任务数据集", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DeepMarkTaskDateset deepMarkTaskDateset)
    {
        List<DeepMarkTaskDateset> list = deepMarkTaskDatesetService.selectDeepMarkTaskDatesetList(deepMarkTaskDateset);
        ExcelUtil<DeepMarkTaskDateset> util = new ExcelUtil<DeepMarkTaskDateset>(DeepMarkTaskDateset.class);
        util.exportExcel(response, list, "标注项目任务数据集数据");
    }

    /**
     * 获取标注项目任务数据集详细信息
     */
    @PreAuthorize("@ss.hasPermi('deeplearn:taskDatesetFile:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(deepMarkTaskDatesetService.selectDeepMarkTaskDatesetById(id));
    }

    /**
     * 新增标注项目任务数据集
     */
    @PreAuthorize("@ss.hasPermi('deeplearn:taskDatesetFile:add')")
    @Log(title = "标注项目任务数据集", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DeepMarkTaskDateset deepMarkTaskDateset)
    {
        return toAjax(deepMarkTaskDatesetService.insertDeepMarkTaskDateset(deepMarkTaskDateset));
    }

    /**
     * 修改标注项目任务数据集
     */
    @PreAuthorize("@ss.hasPermi('deeplearn:taskDatesetFile:edit')")
    @Log(title = "标注项目任务数据集", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DeepMarkTaskDateset deepMarkTaskDateset)
    {
        return toAjax(deepMarkTaskDatesetService.updateDeepMarkTaskDateset(deepMarkTaskDateset));
    }

    /**
     * 删除标注项目任务数据集
     */
    @PreAuthorize("@ss.hasPermi('deeplearn:taskDatesetFile:remove')")
    @Log(title = "标注项目任务数据集", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(deepMarkTaskDatesetService.deleteDeepMarkTaskDatesetByIds(ids));
    }
}
